/// <reference types="vitest" />
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import path from 'path';

export default defineConfig({
  plugins: [react()],
  test: {
    globals: true,
    environment: 'jsdom',
    setupFiles: ['./vitest.setup.ts'],
    include: [
      'src/**/*.{test,spec}.{js,ts,tsx}',
      'src/designer/packages/**/__tests__/**/*.{test,spec}.{js,ts,tsx}'
    ],
    exclude: [
      'node_modules',
      'dist',
      'tests/e2e'
    ],
    coverage: {
      provider: 'v8',
      reporter: ['text', 'json', 'html'],
      exclude: [
        'node_modules/',
        'tests/',
        '**/*.d.ts',
        '**/*.config.{js,ts}',
        '**/dist/**',
        '**/.{next,nuxt,vite}/**',
      ]
    }
  },
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src'),
      '@bill_law6/designable-core': path.resolve(__dirname, './src/designer/packages/designable-core/src'),
      '@bill_law6/designable-react': path.resolve(__dirname, './src/designer/packages/designable-react/src'),
      '@bill_law6/designable-shared': path.resolve(__dirname, './src/designer/packages/designable-shared/src'),
      '@bill_law6/formily-core': path.resolve(__dirname, './src/designer/packages/formily-core/src'),
      '@bill_law6/formily-react': path.resolve(__dirname, './src/designer/packages/formily-react/src'),
      '@bill_law6/formily-reactive': path.resolve(__dirname, './src/designer/packages/formily-reactive/src'),
      '@bill_law6/formily-reactive-react': path.resolve(__dirname, './src/designer/packages/formily-reactive-react/src'),
      '@bill_law6/formily-shared': path.resolve(__dirname, './src/designer/packages/formily-shared/src'),
      '@bill_law6/formily-validator': path.resolve(__dirname, './src/designer/packages/formily-validator/src'),
      '@bill_law6/formily-path': path.resolve(__dirname, './src/designer/packages/formily-path/src'),
      '@bill_law6/formily-json-schema': path.resolve(__dirname, './src/designer/packages/formily-json-schema/src'),
      '@bill_law6/formily-antd-v5': path.resolve(__dirname, './src/designer/packages/formily-antd-v5/src'),
      '@bill_law6/designable-formily-setters': path.resolve(__dirname, './src/designer/packages/designable-formily-setters/src'),
      '@bill_law6/designable-react-settings-form': path.resolve(__dirname, './src/designer/packages/designable-react-settings-form/src')
    }
  }
});